load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "ptp",
    srcs = [
        "ptp_clock_linux.go",
        "ptp_clock_stub.go",
    ],
    cgo = True,
    importpath = "github.com/cockroachdb/cockroach/pkg/util/timeutil/ptp",
    visibility = ["//visibility:public"],
    deps = select({
        "@io_bazel_rules_go//go/platform:aix": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:android": [
            "//pkg/util/log",
            "//pkg/util/timeutil",
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:darwin": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:dragonfly": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:freebsd": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:illumos": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:ios": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:js": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:linux": [
            "//pkg/util/log",
            "//pkg/util/timeutil",
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:netbsd": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:openbsd": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:plan9": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:solaris": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "@io_bazel_rules_go//go/platform:windows": [
            "@com_github_cockroachdb_errors//:errors",
        ],
        "//conditions:default": [],
    }),
)

go_test(
    name = "ptp_test",
    srcs = ["ptp_clock_linux_test.go"],
    embed = [":ptp"],
    deps = select({
        "@io_bazel_rules_go//go/platform:android": [
            "//pkg/util/timeutil",
        ],
        "@io_bazel_rules_go//go/platform:linux": [
            "//pkg/util/timeutil",
        ],
        "//conditions:default": [],
    }),
)
